<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Document</title>
	<style>
		div {
			width: 300px;
			height: 300px;
			background: #58a;
		}
	</style>
</head>
<body>
	<div></div>
	<script>
		var div = document.querySelector('div');
		div.oncontextmenu = function (ev) {
			ev.preventDefault()
			alert(this);
		}
	</script>
</body>
</html>